const express = require('express')

const router = express.Router()


const artcate_hander = require('../router_handler/artcate')


// 导入验证数据的中间件
const expressJoi = require('@escook/express-joi')
// 导入文章分类的验证规则
const {add_cate_schema,delete_cate_schema,get_cate_schema,update_cate_schema} = require('../schema/artcate')




// 挂载路由

router.get('/cates',artcate_hander.getArtCate)

// 新增文章分类的路由
router.post('/addcates',expressJoi(add_cate_schema),artcate_hander.addArtCate)

// 根据id删除文章分类的路由
router.get('/deletecate/:id',expressJoi(delete_cate_schema),artcate_hander.deleteCateById)

// 获取文章的路由
router.get('/cates/:id',expressJoi(get_cate_schema),artcate_hander.getArtCateById)

// 更新文章分类数据的路由
router.post('/updatecate',expressJoi(update_cate_schema),artcate_hander.updateCateById)

module.exports = router